package org.example.property;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: luyg
 * @Date: 2024/09/06/10:42
 * @Description:
 */
public class PropertyValues {

    private final List<PropertyValue> propertyValueList = new ArrayList<>();

    public void addPropertyValue(PropertyValue propertyValue){
        propertyValueList.add(propertyValue);
    }

    public PropertyValue[] getPropertyValues(){
        return propertyValueList.toArray(new PropertyValue[0]);
    }

    public PropertyValue getPropertyValue(String propertyName){
        for (PropertyValue propertyValue : propertyValueList) {
            if(propertyName.equals(propertyValue.getName())){
                return propertyValue;
            }
        }
        return null;
    }
}
